﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CanDoo.Data.Entity;
using CanDoo.Oil.Core.Models;

namespace CanDoo.Oil.Core.ModelConfigurations
{
    /// <summary>
    /// 实体类-数据表映射——售油机序列号
    /// </summary>
    public class OilSalesSerialNumConfiguration : EntityConfigurationBase<OilSalesSerialNum>
    {
        /// <summary>
        /// 初始化一个<see cref="OilSalesSerialNumConfiguration"/>类型的新实例
        /// </summary>
        public OilSalesSerialNumConfiguration()
        {
             ToTable("store_OilSalesSerialNum");
             this.Property(p => p.InStoreTypeId).HasColumnName("InStoreTypeId");
             this.HasOptional(p => p.InStoreType).WithMany().HasForeignKey(p => p.InStoreTypeId).WillCascadeOnDelete(false);

             this.Property(p => p.OutStoreTypeId).HasColumnName("OutStoreTypeId");
             this.HasOptional(p => p.OutStoreType).WithMany().HasForeignKey(p => p.OutStoreTypeId).WillCascadeOnDelete(false);

             this.Property(p => p.WarehouseId).HasColumnName("WarehouseId");
             this.HasOptional(p => p.Warehouse).WithMany().HasForeignKey(p => p.WarehouseId).WillCascadeOnDelete(false);

             this.Property(p => p.ProductId).HasColumnName("ProductId");
             this.HasRequired(p => p.Product).WithMany().HasForeignKey(p => p.ProductId).WillCascadeOnDelete(false);

             this.Property(p => p.ServiceCenterId).HasColumnName("ServiceCenterId");
             this.HasOptional(p => p.ServiceCenter).WithMany().HasForeignKey(p => p.ServiceCenterId).WillCascadeOnDelete(false);

             this.Property(p => p.CustomerId).HasColumnName("CustomerId");
             this.HasOptional(p => p.Customer).WithMany().HasForeignKey(p => p.CustomerId).WillCascadeOnDelete(false);

        }
    }
}
